<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" href="../css/iconfont.css">
    <link rel="stylesheet" href="../css/vant.index.css">
    <link rel="stylesheet" type="text/css" href="../lib/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/blt_row_box.css">
    <link rel="stylesheet" href="../css/blt_zx.css">
    <title>发布</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        html,
        body {
            box-sizing: border-box;
            font-family: Open Sans, Helvetica Neue, Arial, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, sans-serif;
        }

        [v-cloak] {
            display: none;
        }

        .headbar {
            position: fixed;
            text-align: center;
            width: 100%;
            height: 55px;
            top: 0;
            font-size: 20px;
            font-weight: 600;
            padding-top: 25px;
            z-index: 3000;
            background-color: #fff;
            border-bottom: 1px solid rgb(250, 250, 250);
        }

        .headbar .backbtn {
            position: absolute;
            top: 30px;
            left: 5px;
            font-size: 14px;
            font-weight: normal;
            /*background-color: red;*/
        }

        .main {
            padding-top: 60px;
            padding-bottom: 200px;
        }

        .footitem .yes_btn {
            /*width: 100%;*/
            text-align: center;
        }

        .van-checkbox__icon.van-checkbox__icon--round .van-checkbox__label span {
            display: block;
            padding-top: 20px;
            text-align: center;
        }

        .footitem {
            width: 100%;
            position: fixed;
            padding-top: 10px;
            bottom: 0;
            left: 0;
            border-top: 1px solid rgb(246, 247, 248);
            background-color: white;
            padding-bottom: 10px;
        }
    </style>
</head>

<body>
    <div id="container" v-cloak>
        <div class="headbar">
            <div class="backbtn"><span class="iconfont icon-zuojiantou" onclick="window.history.go(-1);">返回</span></div>
            {{ userInfo.blt_name }}
        </div>
        <div class="main">
            <van-cell-group>
                <van-field label-width="40" v-model="FrontUrl" required clearable label="封面" right-icon="iconfont icon-jinggao2" placeholder="请输入封面图片地址" @click-right-icon="$toast('图片链接请使用网络图片链接！')" />
            </van-cell-group>
            <van-cell-group>
                <van-field label-width="40" v-model="TitlemMssage" rows="1" required autosize label="标题" maxlength="13" type="textarea" placeholder="请输入标题（必填）" show-word-limit />
            </van-cell-group>
            <van-cell-group>
                <van-field label-width="40" v-model="ContentMessage" rows="10" autosize label="内容" maxlength="255" type="textarea" placeholder="请输入内容" show-word-limit />
            </van-cell-group>
        </div>
        <div class="footitem">
            <van-radio-group v-model="radiocheck" icon-size="32">
                <van-radio name="1" disabled>
                    资讯
                    <img slot="icon" slot-scope="props" :src="props.checked ? activeIcon : inactiveIcon">
                </van-radio>
                <van-radio name="2">
                    有感而发
                    <img slot="icon" slot-scope="props" :src="props.checked ? activeIcon : inactiveIcon">
                </van-radio>
            </van-radio-group>
            <van-checkbox v-model="checkedbox" icon-size="32" @change="CheckboxGroup_Events">
                <img slot="icon" slot-scope="props" :src="props.checked ? activeIcon : inactiveIcon">
                <span>我遵循文明上网的规则</span>
            </van-checkbox>
            <div class="yes_btn">
                <van-button round type="info" :disabled="yes_btn_disabled" @click="YES_Publish">确认发布</van-button>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery2.0.0.min.js"></script>
<script type="text/javascript" src="../script/vue.js"></script>
<script src="../script/vant.min.js"></script>
<script src="../script/local_db.js"></script>
<script type="text/javascript">
    var url = 'login.html';
    var message = '违规入侵!';
    //没有个人信息的数据就跳转到登陆界面
    var user = $api.getStorage('userInfo');
    if (user == null) {
        alert(message);
        setTimeout(function() {
            window.location.href = url;
        }, 3000);
    }
    var app = new Vue({
        el: '#container',
        data: {
            userInfo: user,
            select_index: 0,
            FrontUrl: '',
            TitlemMssage: '',
            ContentMessage: '',
            radiocheck: '2',
            checkedbox: false,
            yes_btn_disabled: true,
            activeIcon: '../images/system_image/select_succ.png',
            inactiveIcon: '../images/system_image/select_succ_false.png'
        },
        methods: {
            //获取标签的选择情况
            van_tab_change: function(data) {
                this.select_index = data;
            },
            CheckboxGroup_Events: function(data) { //根据是否点击服从条件来确定是否允许发布
                app.yes_btn_disabled = !data;
            },
            //点击了确认发布按钮
            YES_Publish: function(data) {
                var _this = this;
                _this.$toast.loading({
                    message: '加载中...',
                    forbidClick: true,
                    duration: 0,
                });
                setTimeout(function() {
                    _this.$toast.clear();
                }, 5000)
            }
        }
    });
    window.onload = function() {
        $('body,html').animate({
            scrollTop: 0
        }, );
    }
    $(window).resize(function() {
        var width = $(this).width();
        // alert(width);
        // app.resize();
    });
</script>

</html>
